{{include file="../Common/header"}}
	<!--container-->
	<div id="container">
		<div class="car-logo">
			<a href="index.html"><img src="./Public/home/images/car-logo.png"/></a>
		</div> 
		<div class="add">
			<h2 class="add-title">收货地址</h2>
		</div>
		<div class="address-box">
			<p style="color:red;padding-bottom: 5px;">*请选择收货地址</p>
			<script type="text/javascript">
				$(function(){
					$('.address-box .address-con').click(function(){
						$(this).addClass('hover').siblings().removeClass('hover');
						var uaid=$(this).attr('uaid');
						$('#uaid').attr('value',uaid);
					})
				})
			</script>
			{{if value="$addressData"}}
			{{foreach from="$addressData" $key="$k" value="$a"}}
			<div class="address-con" uaid="{{$a['uaid']}}">
				<dt>姓名：{{$a['name']}}</dt>
				<dd>
					<p>电话：{{$a['phone']}}</p>
					<p>地址：{{$a['address']}}</p>
					<p>邮编：{{$a['postcode']}}</p>
				</dd>
				<p class="address-btn">
					<a uaid="{{$a['uaid']}}" class="address-edit">编辑</a>
					<a href="javascript:if(confirm('确定删除吗？')) location.href='{{U('Presonal/del',array('uaid'=>$a['uaid']))}}';" class="address-del">删除</a>
				</p>
			</div>
			{{endforeach}}
			{{endif}}
			<div class="address-add">使用新地址</div>
			
		</div>
		<script type="text/javascript">
		$(function(){
			//初始化方法
			area.init('a');
			//添加新地址
			$('.address-add').click(function(){
				$('#overlay').css({display:'block'});
				$('.add-address').css({display:'block'});
			});
			//关闭、取消
			$('.address-header .address-hidden').click(function(){
				$('#overlay').css({display:'none'});
				$('.address').css({display:'none'});
			});
			$('.address-button span').click(function(){
				$('#overlay').css({display:'none'});
				$('.address').css({display:'none'});
			});
			//编辑收货地址
			$('.address-edit').click(function(){
				$('#overlay').css({display:'block'});
				$('.edit-address').css({display:'block'});
				var uaid=$(this).attr('uaid');
				$.ajax({
					type:"post",
					url:"{{U('Presonal/editAddress')}}",
					data:{uaid:uaid},
					dataType:'json',
					success:function(phpData){
						$('.edit-address .address-name').attr('value',phpData.name);
						$('.edit-address .address-phone').attr('value',phpData.phone);
						$('.edit-address .address-name').attr('value',phpData.name);
						$('.edit-address .xx').attr('value',phpData.xx);
						$('.edit-address .postcode').attr('value',phpData.postcode);
						$('.edit-address .uaid').attr('value',phpData.uaid);
						//初始化方法
						area.init('b');
						//修改的时候默认被选中效果
						 area.selected(phpData.sheng,phpData.shi,phpData.xian);
					}
				});
			
			});
			
		})
		</script>
		<div id="overlay"></div>
		<!--添加-->
		<div class="address add-address">
			<form action="{{U('Presonal/address')}}" method="post">
				<div class="address-header">
					<span>添加收货地址</span>
					<span class="address-hidden">X</span>
				</div>
				<span style="color:red;padding-left:25px;font-size:12px;">注：*标注的为必填项</span>
				<div class="address-tab">
					<p><span class="color">*</span><span>收货人姓名：</span><input type="text" name="name" value=""/></p>
					<p><span class="color">*</span><span>收货人地址：</span>
						<select name="address[]" id="a1">
							
						</select>
						<select name="address[]" id="a2">
							
						</select>
						<select name="address[]" id="a3">
							
						</select>
						<input type="text" name="address[]" value=""/> 
					</p>
					<p><span class="color">*</span><span>手机号码：</span><input type="text" name="phone" value=""/> </p>
					<p><span class="e-span">邮编：</span><input type="text" name="postcode" value=""/></p>
					<input type="hidden" name="shop_user_uid"  value="{{$_SESSION['nickuser']['uid']}}" />
				</div>
				<div class="address-button">
					<input type="submit" value="提交"/><span>取消</span>
				</div>
			</form>
		</div>
		<!--编辑-->
		<div class="address edit-address">
			<form action="{{U('Presonal/edit')}}" method="post">
				<div class="address-header">
					<span>编辑收货地址</span>
					<span class="address-hidden">X</span>
				</div>
				<span style="color:red;padding-left:25px;font-size:12px;">注：*标注的为必填项</span>
				<div class="address-tab">
					<p><span class="color">*</span><span>收货人姓名：</span><input type="text" name="name" class="address-name" value=""/></p>
					<p><span class="color">*</span><span>收货人地址：</span>
						<select name="address[]" id="b1">
							
						</select>
						<select name="address[]" id="b2">
							
						</select>
						<select name="address[]" id="b3">
							
						</select>
						<input type="text" name="address[]" class="xx" value=""/> 
					</p>
					<p><span class="color">*</span><span>手机号码：</span><input type="text" name="phone" class="address-phone" value=""/> </p>
					<p><span class="e-span">邮编：</span><input type="text" name="postcode" class="postcode" value=""/></p>
					<input type="hidden" name="uaid" class="uaid" value="" />
				</div>
				<div class="address-button">
					<input type="submit" value="提交"/><span>取消</span>
				</div>
			</form>
		</div>
		<div class="add">
			<h2 class="add-title">支付方式</h2>
		</div>
		<div class="address-detail">在线支付</div>
		<div class="add">
			<h2 class="add-title">配送方式</h2>
		</div>
		<div class="address-detail">快递配送</div>
		<div class="add">
			<h2 class="add-title">发票信息</h2>
		</div>
		<div class="address-detail">发票抬头：个人</div>
		<div class="add">
			<h2 class="add-title" style="border: none;padding-top: 20px;">确认商品</h2>
		</div>
		<div class="goods-true">
			<span class="goods-name">商品名称</span>
			<span class="goods-money">单品价格</span>
			<span class="goods-num">购买数量</span>
			<span class="goods-money-all">小计</span>
		</div>
		<div class="goods-detail">
			{{foreach from="$goodsListData" value="$g"}}
			<div class="detail-box">
				<div class="detail-detail" gid="{{$g['shop_goods_gid']}}">
					<img src="{{$g['pic']}}" alt="" />
					<p>	{{$g['gname']}}</p>
					<span>{{$g['options']}}</span>
				</div>
				<div class="detail-money">{{number_format($g['oltotal']/$g['olnum'],2)}}元</div>
				<div class="detail-num">{{$g['olnum']}}</div>
				<div class="detail-money-all"><span>{{$g['oltotal']}}</span>元</div>
			</div>
			{{endforeach}}
		</div>
		<form action="{{U('Order/getOrder')}}" method="post">
		<p>*备注:<input type="text" name="remark" id="remark" value="" style="width:500px;"/></p>
		<input type="hidden" name="shop_user_address_uaid" id="uaid" value="" />
		<input type="hidden" name="goid"  class="goid" value="{{$orderData['goid']}}" />
		<div class="checkout-count">
			<ul>
				<li>商品件数：
					<span>{{$orderData['goallnum']}}件</span>
				</li>
				<li>金额合计：
					<span>{{$orderData['gototal']}}元</span>
				</li>
				<li>运费：
					<span>0.00元</span>
				</li>
				<li class="goods-money-true">应付金额：
					<span><strong>{{$orderData['gototal']}}</strong>元</span>
				</li>
			</ul>
		</div>
		
		<div class="checked-btn">
			<a href="{{U('Order/cart')}}">返回购物车</a>
			<input type="submit" value="立即下单" class="checked-btn-order"/>
		</div>
		</form>
	</div>
	<script type="text/javascript">
		$(function(){
			$('.checked-btn-order').click(function(){
				//抓取当前的订单ID
				var goid=$('.goid').attr('value');
				$.ajax({
					type:"post",
					url:"{{U('Order/getOrder')}}",
					data:{goid:goid},
					success:function(){
						window.location.href="{{U('Order/endOrder')}}";
					}
				});
			});
		})
	</script>
	<!--/container-->
	<!--footer-->
	{{include file="../Common/footer"}}
	<!--/footer-->
	</body>
</html>
